﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net.Mail;
/// <summary>
/// Summary description for Email
/// </summary>
public class Email : System.Net.Mail.MailMessage
{
   public Email()
   {
      //System.Net.
   }

   public void Send()
   {
      SendMail(this);
   }

   public static void SendMail(string From, string To, string Subject, string Body, bool BodyisHtml)
   {
      Email m = new Email();
      m.From = new MailAddress(From);
      m.To.Add(new MailAddress(To));
      m.Subject = Subject;
      m.Body = Body;
      m.IsBodyHtml = BodyisHtml;
      SendMail(m);
   }

   public static void SendMail(string To, string Subject, string Body, bool BodyisHtml)
   {
      Email m = new Email();
      m.From = new MailAddress(Settings.DefaultEmail);
      m.To.Add(new MailAddress(To));
      m.Subject = Subject;
      m.Body = Body;
      m.IsBodyHtml = BodyisHtml;
      SendMail(m);
   }

   public static void SendMail(Email email)
   {
      email.Bcc.Add(new MailAddress(Settings.DefaultEmail));
      SmtpClient C = new SmtpClient();
      C.Send(email);
   }
}
